﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UI_RoomItem : MonoBehaviour {


    public Text roomName;
    public Text mapName;
    public Text playersName;
    public Button joinBtn;
    Action onClickJoin;
    private void Awake()
    {
        joinBtn.onClick.AddListener(OnJoinBtn);
    }
    public void SetUIData(RoomData roomData,Action onClickJoin)
    {
        roomName.text = roomData.roomName;
        mapName.text = "测试地图";
        playersName.text = string.Format( "{0}/{1}",roomData.allPlayers.Count,roomData.map.maxPlayer);

        this.onClickJoin = onClickJoin;
    }

    private void OnJoinBtn()
    {
        if (onClickJoin != null)
            onClickJoin();
    }
}
